<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<div
  class="lv-pro-cols-control-con"
  lv-popover
  [lvPopoverContent]="colControlTemplate"

  lvPopoverTrigger="click"
  lvPopoverPosition="bottomRight"
  lvPopoverShowArrow="false"
  lvPopoverClassName="lv-pro-cols-control-panel"
>
  <i lv-icon="lv-icon-col-setting"></i>
</div>

<!-- 列显示/隐藏 -->
<ng-template #colControlTemplate>
  <lv-checkbox-group [(ngModel)]="value" (ngModelChange)="_displayChange($event)" style="max-height: 200px; padding-right: 20px; overflow-y: scroll;">
    <lv-group lvDirection="vertical">
      <ng-container *ngFor="let col of data">
        <lv-checkbox
          *ngIf="ignoringColsType === 'hide'"
          [ngStyle]="{ display: col.hidden === 'ignoring' ? 'none' : '' }"
          [lvValue]="col.key"
          [lvDisabled]="_getDisableStatus(data, value, col)"
          >{{ typeUtils.isRealString(col.name) ? col.name : col.auxiliary }}</lv-checkbox
        >
        <lv-checkbox
          *ngIf="ignoringColsType === 'disable'"
          [lvValue]="col.key"
          [lvDisabled]="col.hidden === 'ignoring' || (value.length === 1 && col.key === value[0])"
          >{{ typeUtils.isRealString(col.name) ? col.name : col.auxiliary }}</lv-checkbox
        >
      </ng-container>
    </lv-group>
  </lv-checkbox-group>
</ng-template>
